package day2;
import java.util.*;
/**
 * @author oldliu
 * @since 1.0
 */
public class ListTest {
    public static void main(String[] args) {
        List list=new ArrayList();//保证顺序，不保证不重复
        list.add("老虎");
        list.add("狮子");
        list.add("老猪");
        list.add("小猫咪");
        list.add(3.1415926);
        list.add(1,"老李");
        list.add("狮子");
        //set是覆盖：
        list.set(0,"藏獒");
        //contains
        //是否包含老刘
        boolean b = list.contains("小猫咪");
        System.out.println("包含？"+b);
        System.out.println(list.size());
        System.out.println(list);
        System.out.println("---------------------");
        for(int i=0;i<list.size();i++){
            Object o = list.get(i);
            System.out.println(o);
        }
        Object r = list.remove(3);
        System.out.println("第四个被删除了："+r);
        System.out.println("集合个数："+list.size());
        System.out.println(list);
        System.out.println(">>>>>>>>增强for>>>>>>>>>>>>>");
        for(Object o:list){
            System.out.print(o+"\t");
        }
    }
}
